package com.woniu.dao;

import com.woniu.dto.ActivityPost;
import com.woniu.pojo.Activity;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ActivityMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Activity record);

    int insertSelective(Activity record);

    Activity selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Activity record);

    int updateByPrimaryKeyWithBLOBs(Activity record);

    int updateByPrimaryKey(Activity record);

    @Select(value = "select ca.*,pi.url,pu.name from community_activity ca,person_image pi,person_user pu where ca.ca_user_id = pu.id and pu.id = pi.person_user_id and ca_type = #{type} and ca_examine_status != 0 order by id desc limit #{page},10")
    List<ActivityPost> selectByType(Integer type, Integer page);

    @Select(value = "select ca.*,pi.url,pu.name from community_activity ca,person_image pi,person_user pu where ca.ca_user_id = pu.id and pu.id = pi.person_user_id and ca_examine_status != 0 order by id desc limit #{page},10")
    List<ActivityPost> selectByPage(Integer page);

    @Select(value = "select * from community_activity where ca_examine_status != 0")
    List<Activity> selectAll();
}